package hu.tortavar2.client.view.adminpages.parts;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.HeadingElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;

public class Item extends Composite {

	private static ItemUiBinder uiBinder = GWT.create(ItemUiBinder.class);

	interface ItemUiBinder extends UiBinder<Widget, Item> {
	}

	public Item() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiField HeadingElement title;
	@UiField Image productImage;
	@UiField Anchor selectItemLink;
	@UiField Anchor deleteItemLink;

	public Item(String productname) {
		initWidget(uiBinder.createAndBindUi(this));
		title.setInnerText(productname);
	}

	@UiHandler("selectItemLink")
	void onClickSelectItem(ClickEvent e) {
		Window.alert("Hello!");
	}

	@UiHandler("deleteItemLink")
	void onClickDeleteItem(ClickEvent e) {
		Window.alert("Hello!");
	}
}
